package main

import (
	"fmt"
	"time"
)

func main() {
	now := time.Now()
	fmt.Printf("%v\n, %[1]T\n", now)
	// 2021-11-14 22:37:31.959920748 +0800 CST m=+0.000058754
	// , time.Time

	t := time.Now().Format("2006-01-02 15:04:05")
	fmt.Printf("format time is: %v\n", t) // 2021-11-14 22:38:54

	fmt.Println(time.Now().Format("20060102150405")) // 20211114224027

	fmt.Println(time.Now().Format("2006-01-02")) // 2021-11-14
	fmt.Println(time.Now().Format("2006"))       //  2021
	fmt.Println(time.Now().Format("01"))         //  11
	fmt.Println(time.Now().Format("02"))         //  14
	fmt.Println(time.Now().Format("15"))         //  22
	fmt.Println(time.Now().Format("04"))         //  41
	fmt.Println(time.Now().Format("05"))         //  51

	t1, _ := time.Parse("2006-01-02 15:04:05", "2021-12-01 14:23:00")
	fmt.Println(t1) // 2021-12-01 14:23:00 +0000 UTC
}
